import request from '@/utils/request'

// 日期排班管理API

/**
 * 添加日期排班
 */
export function addWorkScheduleDate(data) {
  return request({
    url: '/work-schedule-date/add',
    method: 'post',
    data
  })
}

/**
 * 更新日期排班
 */
export function updateWorkScheduleDate(id, data) {
  return request({
    url: `/work-schedule-date/update/${id}`,
    method: 'put',
    data
  })
}

/**
 * 删除日期排班
 */
export function deleteWorkScheduleDate(id) {
  return request({
    url: `/work-schedule-date/delete/${id}`,
    method: 'delete'
  })
}

/**
 * 根据ID查询日期排班详情
 */
export function getWorkScheduleDateById(id) {
  return request({
    url: `/work-schedule-date/${id}`,
    method: 'get'
  })
}

/**
 * 获取我的日期排班列表
 */
export function getMyWorkScheduleDates() {
  return request({
    url: '/work-schedule-date/my-schedules',
    method: 'get'
  })
}

/**
 * 根据日期获取我的日期排班列表
 */
export function getMyWorkScheduleDatesByDate(scheduleDate) {
  return request({
    url: `/work-schedule-date/my-schedules/date/${scheduleDate}`,
    method: 'get'
  })
}

/**
 * 根据日期范围获取我的日期排班列表
 */
export function getMyWorkScheduleDatesByDateRange(startDate, endDate) {
  return request({
    url: '/work-schedule-date/my-schedules/date-range',
    method: 'get',
    params: {
      startDate,
      endDate
    }
  })
}

/**
 * 批量设置日期排班
 */
export function batchSetWorkScheduleDates(data) {
  return request({
    url: '/work-schedule-date/batch-set',
    method: 'post',
    data
  })
}

/**
 * 清空指定日期的排班
 */
export function clearScheduleByDate(scheduleDate) {
  return request({
    url: `/work-schedule-date/clear-date/${scheduleDate}`,
    method: 'delete'
  })
}

/**
 * 获取指定日期的已排班时间段
 */
export function getOccupiedTimeSlotsForDate(scheduleDate) {
  return request({
    url: `/work-schedule-date/occupied-time-slots/${scheduleDate}`,
    method: 'get'
  })
}

/**
 * 从周排班模板复制到指定日期
 */
export function copyFromWeeklyTemplate(scheduleDate) {
  return request({
    url: `/work-schedule-date/copy-from-weekly/${scheduleDate}`,
    method: 'post'
  })
} 